﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using QLTV_BLL;
using QLTV_Public;

namespace QLTV_GiaoDien
{
    public partial class frm_CapNhatTinhTrangTaiLieu : DevExpress.XtraEditors.XtraForm
    {
        public frm_CapNhatTinhTrangTaiLieu()
        {
            InitializeComponent();
        }
        TaiLieu_BLL tailieu_bll = new TaiLieu_BLL();
        private void btn_Luu_Click(object sender, EventArgs e)
        {
            TaiLieu_Public tl = new TaiLieu_Public();
            tl.MaTaiLieu = int.Parse(txt_MaTaiLieu.Text);
            tl.TinhTrang = txt_TinhTrang.Text;
            tailieu_bll.update_TaiLieu_TinhTrang(tl,tl);
            XtraMessageBox.Show("Cập nhật tình trạng của tài liệu thành công!","Thông Báo",MessageBoxButtons.OK,MessageBoxIcon.Information);
            txt_MaTaiLieu.ResetText();
            txt_TinhTrang.ResetText();
        }

        private void btn_Huy_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        private int _MaTaiLieu;

        public int MaTaiLieu
        {
            get { return _MaTaiLieu; }
            set { _MaTaiLieu = value; }
        }
        private void frm_CapNhatTinhTrangTaiLieu_Load(object sender, EventArgs e)
        {
            txt_MaTaiLieu.Text = MaTaiLieu.ToString();
        }

        private void txt_MaTaiLieu_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
                e.Handled = true;
        }
    }
}